<?php


// Use custom admin header/footer

pref('[Loop]/views/pathToSnippetHeader.html', '/Html/Snippet.Header.html');
pref('[Loop]/views/pathToSnippetFooter.html', '/Html/Snippet.Footer.html');

// Dependencies

require_once(PATH_APPLICATION . 'Model/CAccount.php');

if(fv('payload')){
	$payload = json_decode(fv('payload', true), true);

	$account = new Snsfg\CAccount();

	$rawAccounts = $account->find
	(
		array
		(
			'conditions' => array
			(
				'universe' => array(EQUAL, $payload['ef_universe_id'])
			)
		)
	);

	$rawAccountOjects = array();

	foreach($rawAccounts as $rawAccount)
	{
		$rawAccountOjects[$rawAccount['socialNetwork']] = new Snsfg\CAccount();
		$rawAccountOjects[$rawAccount['socialNetwork']]->loadFromRawObject($rawAccount);
		
	}
}
else
{
	$payload['ef_universe_id'] = '';
	$rawAccountOjects = array();
}

v('state', $payload['ef_universe_id']);
v('rawAccountOjects', $rawAccountOjects);
?>